// log_utils.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "logger.h"

void config_log_utils(void) {
	config_filelog_subscriber(_T("..\\debug\\logfile.log"), 500);

	config_log_subscribers(2, subscribe_dbglog, subscribe_filelog);
}

#define TSIZE 10
int volatile cnt = 0;

DWORD WINAPI mt_test(void *p) {
	log_output(_T("mt"), _T("%i"), cnt++);

	return (0);
}

int _tmain(int argc, _TCHAR* argv[])
{
	int log_status = 0;
	int i;
	HANDLE h[TSIZE];

	config_log_utils();

	//log_status = log_output(0, _T("%s debug output is successful! %s"), _T("JoeM"), _T("again"));
	//log_status = log_output(_T("Native"), _T("debug for %s and length is %u"), _T("JoeM"), 12345);

	for (i = 0; i < TSIZE; ++i) {
		h[i] = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&mt_test, (void*)0, 0, 0);
	}
	WaitForMultipleObjects(TSIZE, h, TRUE, -1);

	clean_log_subscribers();
	
	//k = _gettch();
	//printf_s("%c\n", k);
	//printf_s("%i", log_status);
	return 0;
}

